package com.woniuxy.service.impl;

import com.woniuxy.entity.TopicMail;
import com.woniuxy.service.DeadService;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: 马宇航
 * @Description: TODO
 * @DateTime: 22/10/20/0020 14:39
 * @Component: 成都蜗牛学苑
 **/
@Service
public class DeadServiceImpl implements DeadService {
    @Autowired
    RabbitTemplate rabbitTemplate;
    //正常消息 验证ttl超时的消息
    @Override
    public void sendEmail1(TopicMail mail) {
        rabbitTemplate.convertAndSend("forDeathDirectExchange","ttl",mail,new CorrelationData());
    }
    //验证长度超过了队列最大 5个
    @Override
    public void sendEmail2(TopicMail mail) {
        rabbitTemplate.convertAndSend("forDeathDirectExchange","maxlength",mail,new CorrelationData());
    }
}
